namespace RMM.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class remove_xxid : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.AbpUserClaims", "UserId", "dbo.RMM_User");
            DropForeignKey("dbo.RMM_User", "CreatorUserId", "dbo.RMM_User");
            DropForeignKey("dbo.RMM_User", "DeleterUserId", "dbo.RMM_User");
            DropForeignKey("dbo.RMM_User", "LastModifierUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpUserLogins", "UserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpPermissions", "UserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpUserRoles", "UserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpSettings", "UserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpRoles", "CreatorUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpRoles", "DeleterUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpRoles", "LastModifierUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpTenants", "CreatorUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpTenants", "DeleterUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpTenants", "LastModifierUserId", "dbo.RMM_User");
            DropPrimaryKey("dbo.RMM_Massagist");
            DropPrimaryKey("dbo.RMM_User");
            AddColumn("dbo.RMM_MassagistExtend", "MassagistId", c => c.Long(nullable: false));
            AlterColumn("dbo.RMM_Massagist", "Id", c => c.Long(nullable: false));
            AlterColumn("dbo.RMM_User", "Id", c => c.Long(nullable: false));
            AddPrimaryKey("dbo.RMM_Massagist", "Id");
            AddPrimaryKey("dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpUserClaims", "UserId", "dbo.RMM_User", "Id", cascadeDelete: true);
            AddForeignKey("dbo.RMM_User", "CreatorUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.RMM_User", "DeleterUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.RMM_User", "LastModifierUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpUserLogins", "UserId", "dbo.RMM_User", "Id", cascadeDelete: true);
            AddForeignKey("dbo.AbpPermissions", "UserId", "dbo.RMM_User", "Id", cascadeDelete: true);
            AddForeignKey("dbo.AbpUserRoles", "UserId", "dbo.RMM_User", "Id", cascadeDelete: true);
            AddForeignKey("dbo.AbpSettings", "UserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpRoles", "CreatorUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpRoles", "DeleterUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpRoles", "LastModifierUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpTenants", "CreatorUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpTenants", "DeleterUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpTenants", "LastModifierUserId", "dbo.RMM_User", "Id");
            DropColumn("dbo.RMM_MassagistExtend", "UserId");
            DropColumn("dbo.RMM_Massagist", "UserId");
        }
        
        public override void Down()
        {
            AddColumn("dbo.RMM_Massagist", "UserId", c => c.Long(nullable: false));
            AddColumn("dbo.RMM_MassagistExtend", "UserId", c => c.Long(nullable: false));
            DropForeignKey("dbo.AbpTenants", "LastModifierUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpTenants", "DeleterUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpTenants", "CreatorUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpRoles", "LastModifierUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpRoles", "DeleterUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpRoles", "CreatorUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpSettings", "UserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpUserRoles", "UserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpPermissions", "UserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpUserLogins", "UserId", "dbo.RMM_User");
            DropForeignKey("dbo.RMM_User", "LastModifierUserId", "dbo.RMM_User");
            DropForeignKey("dbo.RMM_User", "DeleterUserId", "dbo.RMM_User");
            DropForeignKey("dbo.RMM_User", "CreatorUserId", "dbo.RMM_User");
            DropForeignKey("dbo.AbpUserClaims", "UserId", "dbo.RMM_User");
            DropPrimaryKey("dbo.RMM_User");
            DropPrimaryKey("dbo.RMM_Massagist");
            AlterColumn("dbo.RMM_User", "Id", c => c.Long(nullable: false, identity: true));
            AlterColumn("dbo.RMM_Massagist", "Id", c => c.Long(nullable: false, identity: true));
            DropColumn("dbo.RMM_MassagistExtend", "MassagistId");
            AddPrimaryKey("dbo.RMM_User", "Id");
            AddPrimaryKey("dbo.RMM_Massagist", "Id");
            AddForeignKey("dbo.AbpTenants", "LastModifierUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpTenants", "DeleterUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpTenants", "CreatorUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpRoles", "LastModifierUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpRoles", "DeleterUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpRoles", "CreatorUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpSettings", "UserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpUserRoles", "UserId", "dbo.RMM_User", "Id", cascadeDelete: true);
            AddForeignKey("dbo.AbpPermissions", "UserId", "dbo.RMM_User", "Id", cascadeDelete: true);
            AddForeignKey("dbo.AbpUserLogins", "UserId", "dbo.RMM_User", "Id", cascadeDelete: true);
            AddForeignKey("dbo.RMM_User", "LastModifierUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.RMM_User", "DeleterUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.RMM_User", "CreatorUserId", "dbo.RMM_User", "Id");
            AddForeignKey("dbo.AbpUserClaims", "UserId", "dbo.RMM_User", "Id", cascadeDelete: true);
        }
    }
}
